package name.zxw.vue.controller;

import name.zxw.vue.entity.Student;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.ArrayList;
import java.util.List;

/**
 * @author ZhangXinWang
 * @date 2022/6/6 0:35
 */
@RestController
public class StudentController {

    private static List<Student> students;

    public StudentController() {
        initData();
    }

    private void initData() {
        students = new ArrayList<>();
        students.add(new Student("001", "tom", 18));
        students.add(new Student("002", "jerry", 19));
        students.add(new Student("003", "tony", 120));
    }

    @GetMapping("/students")
    public List<Student> showStudents() {
        return students;
    }


}
